import 'package:flutter/material.dart';

import '../../databases/booklist.dart';
import '../../widgets/common_image.dart';

class NovelDetailAuthor extends StatefulWidget {
  NovelDetailAuthor({Key? key}) : super(key: key);

  @override
  State<NovelDetailAuthor> createState() => _NovelDetailAuthorState();
}

class _NovelDetailAuthorState extends State<NovelDetailAuthor> {
  Widget buildBookList() {
    return Column(
      children: bookListData
          .map((item) => GestureDetector(
                onTap: () {},
                child: Container(
                    padding: EdgeInsets.only(bottom: 20.0, top: 20.0),
                    decoration: BoxDecoration(
                        border: Border(
                            top:
                                BorderSide(width: 1.0, color: Colors.grey))),
                    child: Row(
                      children: [
                        Container(
                            width: 100.0,
                            height: 100.0,
                            child: CommonImage(item.bookListImgUrl!)),
                        Container(
                          height: 90,
                          child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Text('${item.title!}'),
                                Text('${item.title!}'),
                                Text('${item.title!}'),
                              ]),
                        ),
                      ],
                    )),
              ))
          .toList(),
    );
  }

  @override
  Widget build(BuildContext context) {
    var width = MediaQuery.of(context).size.width * 0.33 - 20;

    return Container(
      padding: EdgeInsets.all(10.0),
      child: Column(
        children: [
          Padding(
            padding: EdgeInsets.only(bottom: 10.0),
            child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    '作者还写过',
                    style: TextStyle(
                        fontSize: 18.0,
                        fontWeight: FontWeight.w500,
                        color: Colors.black),
                  ),
                ]),
          ),
          buildBookList(),
        ],
      ),
    );
  }
}
